﻿
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using TL_Cloud.Core.Entities;

namespace TL_Cloud.Models.BookShop
{

    public partial class Bk_StoreUrl : BaseEntity
    {
        public string StoreId { get; set; }
        public string BookId { get; set; }
        public string SrcUrl { get; set; }
        public string PlayUrl { get; set; }
        public decimal? Size { get; set; }
        /// <summary>
        /// 转换状态-1:转化失败 0:未转化 1:转化
        /// </summary>
        public int? ConvertStatus { get; set; }
        public DateTime? CovnertTime { get; set; }
        public string ConvertMessage { get; set; } 
        public string CreateUserId { get; set; }
        public string CreateUserName { get; set; }
        public DateTime? ModifyDate { get; set; }
        public string ModifyUserId { get; set; }
        public string ModifyUserName { get; set; }
        public int? DownloadCount { get; set; }

      
        public override void Create(string userId, string userName)
        {
            this.StoreId = Guid.NewGuid().ToString();
            this.CreateDate = DateTime.Now;
            this.CreateUserId = userId;
            this.CreateUserName = userName;
            this.DownloadCount = 0;
            this.ConvertStatus = 0;
        }
        public override void Modify(string userId, string userName)
        {
            this.ModifyDate = DateTime.Now;
            this.ModifyUserId = userId;
            this.ModifyUserName = userName;
        }
        public override void Mapping(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Bk_StoreUrl>(entity =>
            {
                entity.HasKey(e => e.StoreId);

                entity.ToTable("BK_StoreUrl");

                entity.Property(e => e.StoreId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .ValueGeneratedNever();

                entity.Property(e => e.BookId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ConvertMessage).HasColumnType("text");

                entity.Property(e => e.CovnertTime).HasColumnType("datetime");

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.CreateUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateUserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyDate).HasColumnType("datetime");

                entity.Property(e => e.ModifyUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyUserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.PlayUrl)
                    .HasMaxLength(300)
                    .IsUnicode(false);

                entity.Property(e => e.SrcUrl)
                    .HasMaxLength(300)
                    .IsUnicode(false);
            });
        }
    }
}
